
package com.yimixian.app.fragment;

import com.umeng.analytics.MobclickAgent;
import com.yimixian.app.R;
import com.yimixian.app.activity.YMXMainActivity;
import com.yimixian.app.common.CacheKeys;
import com.yimixian.app.data.DataManager;
import com.yimixian.app.ui.FragmentGroup;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class CartFragmentGroup extends FragmentGroup {
    private TextView titleBarTitle;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_home, container, false);
        titleBarTitle = (TextView) view.findViewById(R.id.title_bar_title);
        titleBarTitle.setText(getString(R.string.my_cart));
        
        return view;
    }

    @Override
    protected void initPrimaryFragment() {
        switchPrimaryFragment(0);
    }

    @Override
    protected Class<? extends android.support.v4.app.Fragment> getPrimaryFragmentClass(
            int fragmentId) {
        if (DataManager.getInstance().get(CacheKeys.TOKEN) == null) {
            return UnloginFragment.class;
        } else {
            return CartFragment.class;
        }
    }

    @Override
    protected Bundle getPrimaryFragmentArguments(int fragmentId) {
        Bundle bundle = new Bundle();
      //  bundle.putInt(YMXMainActivity.TAB_INDEX_KEY, YMXMainActivity.TAB_CART);
        return bundle;
    }

    @Override
    protected int getPrimaryFragmentStubId(int fragmentId) {
        return R.id.fragment_stub;
    }

    @Override
    public void onResume() {
        super.onResume();
        MobclickAgent.onPageStart(this.getClass().getSimpleName());
    }

    @Override
    public void onPause() {
        super.onPause();
        MobclickAgent.onPageEnd(this.getClass().getSimpleName());
    }

}
